Skip to main content

Sugar - Altitude Pressure Module

Functions

Signal:Timing signal - I2C protocol


Module principle

The Earth has gravity, and the closer an object is to the center of the earth, the stronger the gravitational force it receives. Therefore, there is a certain linear relationship between the gravitational force an object receives and its height relative to the earth. The barometric altimeter makes use of this principle by measuring atmospheric pressure with a pressure sensor and indirectly calculating the altitude based on the relationship between pressure and altitude.

Wiring diagram

Future Board Lite mainboard 3 - copy.png

Future Board Lite interfaceWire used
png9009Sugar cube pressure altitude moduleI2CBlack PH2.0-4Pin interface wireuntitled.108.png

Connection supported on I2C Both I2C interfaces are the same
Note: Do not connect to the UART port

Blocks-Function Description

Serial NumberBlock ImageBlock Function
1blocksPng-1710145613462Get the altitude data of the module
2blocksPng-1710145608131Get the air pressure data of the module
3blocksPng-1710145617030Get the temperature data of the module (in Celsius)
4blocksPng-1710145620770Get the temperature data of the module (in Fahrenheit)

Program - Full Program

blocksPng-1711001462634

Program-Function Description

1、Set the color screen to full-color pixel mode and turn off the automatic refresh mode

2、Read the temperature value for judgment, and set this threshold according to actual needsHere, 28 is used as an example for judgment

3、Display the various data of the module on the color screen. Since the data read is decimal, it needs to be converted to a string before it can be displayed on the screen

Using Kittenblock

Run the program offline to view the effect

Using on Microbit

Robotbit_压缩后.png

Programming Platform

Microsoft MakeCode for micro:bit

Use the Makecode programming platform

Add FangTang extension

image-20240311154521941

image.png Search Sugar in extensions, click add

Blocks-Function Description

Serial NumberBlock ImageBlock Function
1image-20240311163810027Get the latest data
2image-20240311163820113Get information about pressure, altitude, temperature, etc.

Circuit Connection

image.png

Microbit InterfaceWire
Sugar cube barometer altitude module.pngSugar cube barometer altitude moduleI2CBlack PH2.0-4Pin interface wireuntitled.108.png

Example Display data

Press the A key to switch display different data image-20240311173255764

Press the B key, display corresponding data according to the mode image-20240311173323483

If the temperature exceeds the set value, a sad face is displayed image-20240311173336824